package com.multithreading.ThreadPool_002;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author zx
 * @version 1.0
 * @package_name: com.multithreading.ThreadPool_002
 * @date 2024/5/20 10:26
 */
public class MyThreadPoolDemo1 {
    public static void main(String[] args) {
        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(
                3,    //核心线程数量，不能小于0
                6,    //最大线程数量，不能小于0，不能小于核心线程数量
                60,    //空闲线程最大存活时间
                TimeUnit.SECONDS, //线程空闲时间单位
                new ArrayBlockingQueue<>(3), //线程队列
                Executors.defaultThreadFactory(), //线程工厂
                new ThreadPoolExecutor.AbortPolicy() //拒绝策略
        );
    }
}
